package com.common.operationLog.controller;

import com.common.operationLog.pojo.req.OperationLogReqDTO;
import com.common.operationLog.pojo.res.OperationLogModuleResDTO;
import com.common.operationLog.pojo.res.OperationLogResDTO;
import com.common.operationLog.service.IOperationLogService;
import com.xiaopeng.common.httpResult.model.HttpResult;
import com.xiaopeng.common.page.PageVO;
import io.swagger.v3.oas.annotations.Operation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 操作日志记录表 前端控制器
 * </p>
 *
 * @author xiaopeng
 * @since 2025-05-25
 */
@RestController
@RequestMapping("/common/operationLog")
public class OperationLogController {

    @Resource
    private IOperationLogService operationLogService;

    @Operation(summary = "操作日志-获取操作日志操作模块和操作类型")
    @PostMapping("/getModuleAndTypeList")
    public HttpResult<List<OperationLogModuleResDTO>> getModuleAndTypeList() {
        return HttpResult.success(operationLogService.getModuleAndTypeList());
    }

    @Operation(summary = "操作日志-分页列表")
    @PostMapping("/page")
    public HttpResult<PageVO<OperationLogResDTO>> page(@RequestBody OperationLogReqDTO reqDTO) {
        return HttpResult.success(operationLogService.selectPage(reqDTO));
    }

}
